<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>ttk::combobox manual page - Tk Themed Widget</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tk Commands</a> <small>&gt;</small> ttk_combobox</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="ttk_combobox.htm#M2" NAME="L1797">NAME</A>
<DL><DD>ttk::combobox &mdash; text field with popdown selection list</DD></DL>
<DD><A HREF="ttk_combobox.htm#M3" NAME="L1798">SYNOPSIS</A>
<DL>
</DL>
<DD><A HREF="ttk_combobox.htm#M4" NAME="L1799">DESCRIPTION</A>
<DD><A HREF="ttk_combobox.htm#M5" NAME="L1800">STANDARD OPTIONS</A>
<DL>
<DD><A HREF="ttk_widget.htm#M-class">-class, undefined, undefined</A>
<DD><A HREF="ttk_widget.htm#M-cursor">-cursor, cursor, Cursor</A>
<DD><A HREF="ttk_widget.htm#M-style">-style, style, Style</A>
<DD><A HREF="ttk_widget.htm#M-takefocus">-takefocus, takeFocus, TakeFocus</A>
</DL>
<DD><A HREF="ttk_combobox.htm#M6" NAME="L1801">WIDGET-SPECIFIC OPTIONS</A>
<DL>
<DD><A HREF="ttk_combobox.htm#M7" NAME="L1802">-exportselection, exportSelection, ExportSelection</A>
<DD><A HREF="ttk_combobox.htm#M8" NAME="L1803">-justify, justify, Justify</A>
<DD><A HREF="ttk_combobox.htm#M9" NAME="L1804">-height, height, Height</A>
<DD><A HREF="ttk_combobox.htm#M10" NAME="L1805">-postcommand, postCommand, PostCommand</A>
<DD><A HREF="ttk_combobox.htm#M11" NAME="L1806">-state, state, State</A>
<DD><A HREF="ttk_combobox.htm#M12" NAME="L1807">-textvariable, textVariable, TextVariable</A>
<DD><A HREF="ttk_combobox.htm#M13" NAME="L1808">-values, values, Values</A>
<DD><A HREF="ttk_combobox.htm#M14" NAME="L1809">-width, width, Width</A>
</DL>
<DD><A HREF="ttk_combobox.htm#M15" NAME="L1810">WIDGET COMMAND</A>
<DL class="widget command">
<DD><A HREF="ttk_combobox.htm#M16" NAME="L1811"><I>pathName </I><B>current</B> ?<I>newIndex</I>?</A>
<DD><A HREF="ttk_combobox.htm#M17" NAME="L1812"><I>pathName </I><B>get</B></A>
<DD><A HREF="ttk_combobox.htm#M18" NAME="L1813"><I>pathName </I><B>set</B> <I>value</I></A>
</DL>
<DD><A HREF="ttk_combobox.htm#M19" NAME="L1814">VIRTUAL EVENTS</A>
<DD><A HREF="ttk_combobox.htm#M20" NAME="L1815">STYLING OPTIONS</A>
<DD><A HREF="ttk_combobox.htm#M21" NAME="L1816">SEE ALSO</A>
<DD><A HREF="ttk_combobox.htm#M22" NAME="L1817">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
ttk::combobox &mdash; text field with popdown selection list
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>ttk::combobox</B> <I>pathName </I>?<I>options</I>?<BR>
<H3><A NAME="M4">DESCRIPTION</A></H3>
A <B>ttk::combobox</B> combines a text field with a pop-down list of values;
the user may select the value of the text field from among the
values in the list.
<H3><A NAME="M5">STANDARD OPTIONS</A></H3>
<DL>
<DT><B><A HREF="ttk_widget.htm#M-class">-class, undefined, undefined</A></B>
<DT><B><A HREF="ttk_widget.htm#M-cursor">-cursor, cursor, Cursor</A></B>
<DT><B><A HREF="ttk_widget.htm#M-style">-style, style, Style</A></B>
<DT><B><A HREF="ttk_widget.htm#M-takefocus">-takefocus, takeFocus, TakeFocus</A></B>
</DL>
<H3><A NAME="M6">WIDGET-SPECIFIC OPTIONS</A></H3>
<DL>
<DT>Command-Line Name: <B><A NAME="M7">-exportselection</A></B>
<DT>Database Name: <B>exportSelection</B>
<DT>Database Class: <B>ExportSelection</B>
<DD>Boolean value.
If set, the widget selection is linked to the X selection.
<P><DT>Command-Line Name: <B><A NAME="M8">-justify</A></B>
<DT>Database Name: <B>justify</B>
<DT>Database Class: <B>Justify</B>
<DD>Specifies how the text is aligned within the widget.
Must be one of <B>left</B>, <B>center</B>, or <B>right</B>.
<P><DT>Command-Line Name: <B><A NAME="M9">-height</A></B>
<DT>Database Name: <B>height</B>
<DT>Database Class: <B>Height</B>
<DD>Specifies the height of the pop-down listbox, in rows.
<P><DT>Command-Line Name: <B><A NAME="M10">-postcommand</A></B>
<DT>Database Name: <B>postCommand</B>
<DT>Database Class: <B>PostCommand</B>
<DD>A Tcl script to evaluate immediately before displaying the listbox.
The <B>-postcommand</B> script may specify the <B>-values</B> to display.
<P><DT>Command-Line Name: <B><A NAME="M11">-state</A></B>
<DT>Database Name: <B>state</B>
<DT>Database Class: <B>State</B>
<DD>One of <B>normal</B>, <B>readonly</B>, or <B>disabled</B>.
In the <B>readonly</B> state,
the value may not be edited directly, and
the user can only select one of the <B>-values</B> from the
dropdown list.
In the <B>normal</B> state,
the text field is directly editable.
In the <B>disabled</B> state, no interaction is possible.
<P><DT>Command-Line Name: <B><A NAME="M12">-textvariable</A></B>
<DT>Database Name: <B>textVariable</B>
<DT>Database Class: <B>TextVariable</B>
<DD>Specifies the name of a global variable whose value is linked
to the widget value.
Whenever the variable changes value the widget value is updated,
and vice versa.
<P><DT>Command-Line Name: <B><A NAME="M13">-values</A></B>
<DT>Database Name: <B>values</B>
<DT>Database Class: <B>Values</B>
<DD>Specifies the list of values to display in the drop-down listbox.
<P><DT>Command-Line Name: <B><A NAME="M14">-width</A></B>
<DT>Database Name: <B>width</B>
<DT>Database Class: <B>Width</B>
<DD>Specifies an integer value indicating the desired width of the entry window,
in average-size characters of the widget's font.
</DL>
<H3><A NAME="M15">WIDGET COMMAND</A></H3>
The following subcommands are possible for combobox widgets:
<P>
<DL class="widget command">
<DT><A NAME="M16"><I>pathName </I><B>current</B> ?<I>newIndex</I>?</A><DD>
If <I>newIndex</I> is supplied, sets the combobox value
to the element at position <I>newIndex</I> in the list of <B>-values</B>
(in addition to integers, the <B>end</B> index is supported and indicates
the last element of the list).
Otherwise, returns the index of the current value in the list of
<B>-values</B> or <B>-1</B> if the current value does not appear in the list.
<P><DT><A NAME="M17"><I>pathName </I><B>get</B></A><DD>
Returns the current value of the combobox.
<P><DT><A NAME="M18"><I>pathName </I><B>set</B> <I>value</I></A><DD>
Sets the value of the combobox to <I>value</I>.
<P></DL>
<P>
The combobox widget also supports the following <B><A HREF="../TkCmd/ttk_entry.htm">ttk::entry</A></B>
widget subcommands (see <I>ttk::entry(n)</I> for details):
<dl><dd><table border="0"><tr><td><p class="tablecell"><B>bbox</B><td><p class="tablecell"><B>delete</B><td><p class="tablecell"><B>icursor</B><tr><td><p class="tablecell"><B>index</B><td><p class="tablecell"><B>insert</B><td><p class="tablecell"><B>selection</B><tr><td><p class="tablecell"><B>xview</B></table></dl>
The combobox widget also supports the following generic <B><A HREF="../TkCmd/ttk_widget.htm">ttk::widget</A></B>
widget subcommands (see <I>ttk::widget(n)</I> for details):
<dl><dd><table border="0"><tr><td><p class="tablecell"><B>cget</B><td><p class="tablecell"><B>configure</B><td><p class="tablecell"><B>identify</B><tr><td><p class="tablecell"><B>instate</B><td><p class="tablecell"><B>state</B></table></dl>
<H3><A NAME="M19">VIRTUAL EVENTS</A></H3>
The combobox widget generates a <B>&lt;&lt;ComboboxSelected&gt;&gt;</B> virtual event
when the user selects an element from the list of values.
If the selection action unposts the listbox,
this event is delivered after the listbox is unposted.
<H3><A NAME="M20">STYLING OPTIONS</A></H3>
The class name for a <B>ttk::combobox</B> is <B>TCombobox</B>.
The <B>ttk::combobox</B> uses the <B><A HREF="../TkCmd/entry.htm">entry</A></B> and
<B><A HREF="../TkCmd/listbox.htm">listbox</A></B> widgets internally.
The listbox frame has a class name of <B>ComboboxPopdownFrame</B>.
<P>
Dynamic states: <B>disabled</B>, <B><A HREF="../TkCmd/focus.htm">focus</A></B>, <B>pressed</B>, <B>readonly</B>.
<P>
<B>TCombobox</B> styling options configurable with <B><A HREF="../TkCmd/ttk_style.htm">ttk::style</A></B>
are:
<P>
<B>-arrowcolor</B> <I>color</I>
<BR>
<B>-arrowsize</B> <I>amount</I>
<BR>
<B>-background</B> <I>color</I>
<BR>
<B>-bordercolor</B> <I>color</I>
<BR>
<B>-darkcolor</B> <I>color</I>
<BR>
<B>-focusfill</B> <I>color</I>
<BR>
<B>-foreground</B> <I>color</I>
<BR>
<B>-fieldbackground</B> <I>color</I>
<DL><DD>
Can only be changed when using non-native and non-graphical themes.
</DL>
<B>-insertcolor</B> <I>color</I>
<BR>
<B>-insertwidth</B> <I>amount</I>
<BR>
<B>-lightcolor</B> <I>color</I>
<BR>
<B>-padding</B> <I>padding</I>
<BR>
<B>-postoffset</B> <I>padding</I>
<BR>
<B>-selectbackground</B> <I>color</I>
<DL><DD>
Text entry select background.
</DL>
<B>-selectforeground</B> <I>color</I>
<DL><DD>
Text entry select foreground.
</DL>
<P>
The <B>ttk::combobox</B> popdown listbox cannot be configured using
<B><A HREF="../TkCmd/ttk_style.htm">ttk::style</A></B> nor via the widget <B>configure</B> command.  The listbox
can be configured using the option database.
<P>
option add *TCombobox*Listbox.background <I>color</I>
<BR>
option add *TCombobox*Listbox.font <I>font</I>
<BR>
option add *TCombobox*Listbox.foreground <I>color</I>
<BR>
option add *TCombobox*Listbox.selectBackground <I>color</I>
<BR>
option add *TCombobox*Listbox.selectForeground <I>color</I>
<P>
To configure a specific listbox (subject to future change):
<PRE>set popdown [ttk::combobox::PopdownWindow .mycombobox]
$popdown.f.l configure -font <I>font</I></PRE>
<P>
<B>ComboboxPopdownFrame</B>
styling options configurable with <B><A HREF="../TkCmd/ttk_style.htm">ttk::style</A></B>
are:
<P>
<B>-borderwidth</B> <I>amount</I>
<BR>
<B>-relief</B> <I>relief</I>
<P>
Some options are only available for specific themes.
<P>
See the <B><A HREF="../TkCmd/ttk_style.htm">ttk::style</A></B> manual page for information on how to configure
ttk styles.
<H3><A NAME="M21">SEE ALSO</A></H3>
<B><A HREF="../TkCmd/ttk_widget.htm">ttk::widget</A></B>, <B><A HREF="../TkCmd/ttk_entry.htm">ttk::entry</A></B>
<H3><A NAME="M22">KEYWORDS</A></H3>
<A href="../Keywords/C.htm#choice">choice</A>, <A href="../Keywords/E.htm#entry">entry</A>, <A href="../Keywords/L.htm#list box">list box</A>, <A href="../Keywords/T.htm#text box">text box</A>, <A href="../Keywords/W.htm#widget">widget</A>
<div class="copy">Copyright &copy; 2004 Joe English
</div>
</BODY></HTML>
